﻿<cfsilent>
	<cfscript>
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		stringAdvice = getProperty("serviceFactory").getBean("stringAdvice");
		mathAdvice = getProperty("serviceFactory").getBean("senateMathAdvice");

		event.setArg("pageTitle", "教师门户 - 网上评教 - 教学班评教结果");
		
		teacherId = sessionAdvice.getAutherUserID();
		
		taskType = event.getArg("TT");
		taskId = event.getArg("TSK");
		evsId = event.getArg("ES");
		secureTicket = event.getArg("ST");
		
		/* 安全设置 */
		viewSecure = false;
		
		/* 首先做安全检查 */
		try {
			stringOrignal = decrypt( secureTicket, teacherId, "PBEWithMD5AndDES", "Hex");
			stringTest = evsId & taskType & taskId;
			
			if ( stringOrignal eq stringTest ) {
				viewSecure = true;
			}
		}
		catch(any excpt) {
		}

		/* 读取教学班信息 */
		rs_task = queryNew("cidx, task_week, task_time, task_place, course_name, course_code, course_credit, tch_name, tch_name_sec, tch_name_ace");

		if ( viewSecure ) {
			
			switch ( taskType ) {
			
				case "P":
				
					sql = "SELECT 
								a.cidx, a.task_week, 
								CASE WHEN a.task_time is null then '-' else task_time END task_time, 
								CASE WHEN a.task_place is null then '-' else task_place END task_place, 
								b.course_name, b.course_code, b.course_credit, 
								c.tch_name, 
								d.tch_name tch_name_sec, 
								e.tch_name tch_name_ace, 
								f.institute_name 
							FROM t_task a 
								INNER JOIN t_course b ON a.cid = b.cid 
								INNER JOIN t_teacher c ON a.tch_id = c.tch_id 
								INNER JOIN t_teacher d ON a.tch_id_sec = d.tch_id 
								INNER JOIN t_teacher e ON a.tch_id_ace = e.tch_id 
								INNER JOIN t_institute f ON b.institute_id = f.institute_id
							WHERE 
								a.tsk_id = :taskId ";
				
					break;

				case "C":
					
					sql = "SELECT 
								a.cidx, a.task_week, 
								CASE WHEN a.task_time is null then '-' else task_time END task_time, 
								CASE WHEN a.task_place is null then '-' else task_place END task_place, 
								b.course_name, b.course_code, b.course_credit, 
								c.tch_name, 
								d.tch_name tch_name_sec, 
								e.tch_name tch_name_ace, 
								f.institute_name 
							FROM t_common_task a 
								INNER JOIN t_course b ON a.cid = b.cid 
								INNER JOIN t_teacher c ON a.tch_id = c.tch_id 
								INNER JOIN t_teacher d ON a.tch_id_sec = d.tch_id 
								INNER JOIN t_teacher e ON a.tch_id_ace = e.tch_id 
								INNER JOIN t_institute f ON b.institute_id = f.institute_id
							WHERE 
								a.tsk_id = :taskId ";
						
					break;

				case "T":
					
					sql = "SELECT 
								a.cidx, a.task_week, 
								CASE WHEN a.task_time is null then '-' else task_time END task_time, 
								CASE WHEN a.task_place is null then '-' else task_place END task_place, 
								b.course_name, b.course_code, b.course_credit, 
								c.tch_name, 
								d.tch_name tch_name_sec, 
								e.tch_name tch_name_ace, 
								f.institute_name 
							FROM t_sport_task a 
								INNER JOIN t_course b ON a.cid = b.cid 
								INNER JOIN t_teacher c ON a.tch_id = c.tch_id 
								INNER JOIN t_teacher d ON a.tch_id_sec = d.tch_id 
								INNER JOIN t_teacher e ON a.tch_id_ace = e.tch_id 
								INNER JOIN t_institute f ON b.institute_id = f.institute_id
							WHERE 
								a.tsk_id = :taskId ";
					
					break;
	
				case "R":
					
					sql = "SELECT 
								a.cidx, a.task_week, 
								CASE WHEN a.task_time is null then '-' else task_time END task_time, 
								CASE WHEN a.task_place is null then '-' else task_place END task_place, 
								b.course_name, b.course_code, b.course_credit, 
								c.tch_name, 
								d.tch_name tch_name_sec, 
								e.tch_name tch_name_ace, 
								f.institute_name 
							FROM t_reopen_task a 
								INNER JOIN t_course b ON a.cid = b.cid 
								INNER JOIN t_teacher c ON a.tch_id = c.tch_id 
								INNER JOIN t_teacher d ON a.tch_id_sec = d.tch_id 
								INNER JOIN t_teacher e ON a.tch_id_ace = e.tch_id 
								INNER JOIN t_institute f ON b.institute_id = f.institute_id
							WHERE 
								a.tsk_id = :taskId ";
					
					break;
			
			}
		
			queryObj = new Query( datasource=application.dnsSlave );
			queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );

			rs_task = queryObj.execute( sql=sql ).getResult();
			
			
			/* 教师列表 */
			teacherList = rs_task.tch_name;
			
			if ( not listFind( teacherList, rs_task.tch_name_sec, "/" ) ) {
				teacherList = listAppend( teacherList, rs_task.tch_name_sec, "/" );
			}
			
			if ( not listFind( teacherList, rs_task.tch_name_ace, "/" ) ) { 
				teacherList = listAppend( teacherList, rs_task.tch_name_ace, "/" );
			}

		}
		
		/* 判断当前显示课表内容 */
		currentTab = event.getArg("TabID", "labQuestionnaire");
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('evaluateStatus')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">网上评教</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i>教学班网上评教结果
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labQuestionnaire">class="active"</cfif> id="labQuestionnaire" tabTarget="Questionnaire">指标得分</span>
						<span <cfif currentTab eq "labSuggest">class="active"</cfif> id="labSuggest" tabTarget="Suggest">意见和建议</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Questionnaire" class="tabContent">
					
					<cfif viewSecure>
					
							<div class="noticeBlock">
								<h3>《<cfoutput>#rs_task.course_name#</cfoutput>》- <cfoutput>#teacherList#</cfoutput> 评价观测点得分情况</h3>
								<p>
									<span class="img icon16x16 message"></span> 
									<cfif rs_task.course_code neq "-">课程号 <em><cfoutput>#rs_task.course_code#</cfoutput></em></cfif>
									课程总学分:<em><cfoutput>#numberFormat(rs_task.course_credit , '_.00')#</cfoutput></em>
									任课单位: <cfoutput>#rs_task.institute_name#</cfoutput>
									<cfif rs_task.task_time neq "-">上课时间: <cfoutput>#mathAdvice.convertTaskTime( rs_task.task_time )#</cfoutput></cfif>
									<cfif rs_task.task_place neq "-">上课地点: <cfoutput>#rs_task.task_place#</cfoutput></cfif>
								</p>
								<hr/>
							</div>
							
							<!--- 显示评教指标统计--->
							<!-- evaluateTaskSummary -->
							<cfoutput>#event.getArg("evaluateTaskSummary")#</cfoutput>
							<!-- /evaluateTaskSummary -->
							
						<cfelse>
							
							<div class="systemNotice">
								<p class="mln">看起来, 您当前学期没有评教数据.</p>
							</div>
							
					</cfif>
					
				</div>

				<div id="Suggest" class="tabContent">
					
					<cfif viewSecure>
							
							<div class="noticeBlock">
								<h3>《<cfoutput>#rs_task.course_name#</cfoutput>》- <cfoutput>#teacherList#</cfoutput> 学生反馈意见及建议</h3>
								<p>
									<span class="img icon16x16 message"></span> 
									<cfif rs_task.course_code neq "-">课程号 <em><cfoutput>#rs_task.course_code#</cfoutput></em></cfif>
									课程总学分:<em><cfoutput>#numberFormat(rs_task.course_credit , '_.00')#</cfoutput></em>
									任课单位: <cfoutput>#rs_task.institute_name#</cfoutput>
									<cfif rs_task.task_time neq "-">上课时间: <cfoutput>#mathAdvice.convertTaskTime( rs_task.task_time )#</cfoutput></cfif>
									<cfif rs_task.task_place neq "-">上课地点: <cfoutput>#rs_task.task_place#</cfoutput></cfif>
								</p>
								<hr/>
							</div>
							
							<!--- 显示教学班评论信息--->
							<!-- evaluateTaskComment -->
							<cfoutput>#event.getArg("evaluateTaskComment")#</cfoutput>
							<!-- /evaluateTaskComment -->
							
						<cfelse>
							<div class="systemNotice">
								<p class="mln">看起来, 您当前学期没有评教数据.</p>
							</div>
					</cfif>

				</div>
				
			</div>
		</li>
	</ul>
</div>

